import React, { Component } from 'react'
// hoc是高阶组件，本质是一个函数，他的参数和返回值都是组件
function hoc(C) {
  return class Component extends Component {
    render() {{
      return (
        <div>
          <p>这是hoc添加的功能</p>
          <C></C>
        </div>
      )
    }}
  }
}

class Com1 extends Component {
  render() {
    return (
      <div>
        com1
      </div>
    )
  }
}
class Com2 extends Component {
  render() {
    return (
      <div>
        com2
      </div>
    )
  }
}

const Com1Pro = hoc(Com1);
const Com2Pro = hoc(Com2);

export default class HOC extends Component {
  render() {
    return (
      <div>
        <Com1Pro></Com1Pro>
        <Com2Pro></Com2Pro>
      </div>
    )
  }
}
